﻿using NHibernate;
using NUnit.Framework;
using SimpleServiceBus.Persistence.NHibernate;

namespace SimpleServiceBus.Tests.Persistence.NHibernate
{
    [TestFixture,Explicit]
    public class SessionManagerTestFixture
    {
        private DataSessionManager _dataSessionManager;
        

        [TestFixtureSetUp]
        public void FixtureSetUp()
        {
            _dataSessionManager = new DataSessionManager(new ThreadStaticSession());    
        }

        [TestFixtureTearDown]
        public void FixtureTearDown()
        {
            if (_dataSessionManager != null)
                _dataSessionManager.Dispose();
        }
       

        [Test]
        public void CanGenerateSchema()
        {
            _dataSessionManager.CreateSchema();
        }

        [Test]
        public void CanUpdateSchema()
        {
            _dataSessionManager.UpdateSchema();
        }

        [Test]
        public void Can_Load_Configuration_With_Mappings()
        {
            ISession session = _dataSessionManager.CreateSession();

            Assert.IsNotNull(session);
        }
    }
}
